#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int MAXN = 6e6+7;
int prime[MAXN], p_cnt;
int mu[MAXN];
bool not_p[MAXN];
map<LL, LL> muAns;
void Init() {
    p_cnt = 0;
    mu[1] = 1;
    for (int i=2; i<MAXN; ++i) {
        if (!not_p[i]) {
            prime[p_cnt++] = i;
            mu[i] = -1;
        }
        for (int j=0; j<p_cnt&&i*prime[j]<MAXN; ++j) {
            not_p[i*prime[j]] = true;
            if (i%prime[j]==0) {
                mu[i*prime[j]] = 0;
                break;
            }
            mu[i*prime[j]] = -mu[i];
        }
    }
    mu[0] = 0;
    for (int i=1; i<MAXN; ++i) {
        mu[i] += mu[i-1];
    }
}
LL solve(LL n) {
    if (n<MAXN) return mu[n];
    if (muAns.count(n)) return muAns[n];
    LL ret = 1;
    for (LL i=2, last; i<=n; i=last+1) {
        last = n/(n/i);
        ret -= (last-i+1)*solve(n/i);
    }
    muAns[n] = ret;
    return ret;
}


int main() {
#ifdef hai
    freopen("in.txt", "r", stdin);
#endif
    Init();
    LL a, b;
    while (~scanf("%lld %lld", &a, &b)) {
        printf("%lld\n", solve(b)-solve(a-1));
    }
    return 0;
}
